#pragma once 
#include<time.h>
#include "Task.hpp"
#include "ThreadPool.hpp"
#include<unistd.h>

int main()
{
  srand((size_t)time(nullptr));
  ThreadPool<Task>* t = ThreadPool<Task>::GetInstance();
  //t->InitThreadPool();
  const char* str = "+-*/%"; //枚举操作符
  while(1)
  {
    //rand % A == >得到的值:[0,A-1)
    int x = rand() % 20 +1 ;//[1,20]
    int y = rand() % 10 + 1;//[1,10]
    char op = str[rand()%5]; 
    cout << "发布的任务是: " << x <<" " << op <<" " << y << " = ?" << endl;  
    sleep(3);
    Task task(x,y,op);
    t->push(task);
  }
  return 0;
}
